using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;

namespace Janus.NorthwindDemo2007
{
	namespace NorthwindDataTableAdapters
	{

		public partial class CustomersTableAdapter
		{
			public virtual NorthwindData.CustomersDataTable GetData(string customerID)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				selectCommand.CommandText = "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, " + "City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE CustomerID ='" + customerID + "'";
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				NorthwindData.CustomersDataTable dataTable = new NorthwindData.CustomersDataTable();
				this.Adapter.Fill(dataTable);
				return dataTable;
			}
		}
		public partial class Product_CategoriesTableAdapter
		{

			public virtual int FillByProduct(int productId, NorthwindData.Product_CategoriesDataTable dataTable)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				string whereClause = null;
				whereClause = " WHERE ProductID = " + productId;
				selectCommand.CommandText = this.CommandCollection[0].CommandText + whereClause;
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill == true)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
		}
		public partial class Suppliers_ProductsTableAdapter
		{
			public virtual int FillBySupplier(int supplierID, NorthwindData.Suppliers_ProductsDataTable dataTable)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				string whereClause = null;
				whereClause = " WHERE SupplierID = " + supplierID;
				selectCommand.CommandText = this.CommandCollection[0].CommandText + whereClause;
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill == true)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
			public virtual int FillByProduct(int productId, NorthwindData.Suppliers_ProductsDataTable dataTable)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				string whereClause = null;
				whereClause = " WHERE ProductID = " + productId;
				selectCommand.CommandText = this.CommandCollection[0].CommandText + whereClause;
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill == true)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
		}
		public partial class OrderDetailsExtendedTableAdapter
		{
			public virtual int FillByCustomer(string customerID, NorthwindData.OrderDetailsExtendedDataTable dataTable)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				string whereClause = null;
				if (! string.IsNullOrEmpty(customerID))
				{
					whereClause = " WHERE CustomerID = '" + customerID + "'";
				}
				else
				{
					whereClause = "";
				}
				selectCommand.CommandText = "SELECT Orders.OrderID, Orders.EmployeeID, Orders.CustomerID, Orders.OrderDate, " + "[Order Details].ProductID, [Order Details].UnitPrice, [Order Details].Quantity, [Order Details].Discount, " + "([Order Details].UnitPrice * [Order Details].Quantity * (1- [Order Details].Discount)) AS Total " + "FROM (Orders INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) " + whereClause;
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill == true)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
			public virtual int FillByProduct(int productId, NorthwindData.OrderDetailsExtendedDataTable dataTable)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				selectCommand.CommandText = "SELECT Orders.OrderID, Orders.EmployeeID, Orders.CustomerID, Orders.OrderDate, " + "[Order Details].ProductID, [Order Details].UnitPrice, [Order Details].Quantity, [Order Details].Discount, " + "([Order Details].UnitPrice * [Order Details].Quantity * (1- [Order Details].Discount)) AS Total " + "FROM (Orders INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) " + "WHERE ProductID = " + productId;
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
		}
		public partial class ProductsTableAdapter
		{
			public virtual int Fill(int supplierId, NorthwindData.ProductsDataTable dataTable)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				selectCommand.CommandText = "SELECT ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, " + "UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued, OnSale FROM Products " + "WHERE SupplierID = " + supplierId;
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
		}
		public partial class Order_DetailsTableAdapter
		{
			public virtual int Fill(int orderId, NorthwindData.Order_DetailsDataTable dataTable)
			{
				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				selectCommand.CommandText = "SELECT OrderID, ProductID, UnitPrice, Quantity, Discount FROM [Order Details] " + "WHERE OrderID = " + orderId;
				selectCommand.CommandType = System.Data.CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill == true)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
		}
		public partial class OrdersExtendedTableAdapter
		{

			public virtual int Fill(string customerID, NorthwindData.OrdersExtendedDataTable dataTable)
			{

				System.Data.OleDb.OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand();
				selectCommand.Connection = this.Connection;
				string whereClause = null;
				if (! string.IsNullOrEmpty(customerID))
				{
					whereClause = " WHERE CustomerID = '" + customerID + "'";
				}
				else
				{
					whereClause = "";
				}
				selectCommand.CommandText = "SELECT OrderID, OrderDate, CustomerID, Employee, ShipVia, Paid, Customer, EmployeeID " + "FROM OrdersExtended" + whereClause;
				selectCommand.CommandType = CommandType.Text;
				this.Adapter.SelectCommand = selectCommand;
				if (this.ClearBeforeFill == true)
				{
					dataTable.Clear();
				}
				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
		}
		//Partial Class OrderDetailsInfoTableAdapter

		//    Public Overridable Overloads Function Fill(ByVal customerID As String, ByVal dataTable As NorthwindData.OrderDetailsInfoDataTable) As Integer
		//        Dim selectCommand As New System.Data.OleDb.OleDbCommand()
		//        selectCommand.Connection = Me.Connection
		//        Dim whereClause As String
		//        If (Not String.IsNullOrEmpty(customerID)) Then
		//            whereClause = " WHERE CustomerID = '" & customerID & "'"
		//        Else
		//            whereClause = ""
		//        End If
		//        selectCommand.CommandText = "SELECT OrderID, ProductName, Quantity, UnitPrice, Discount, CategoryName, OrderDate, CustomerID " & _
		//        "FROM OrderDetailsInfo" & whereClause
		//        selectCommand.CommandType = CommandType.Text
		//        Me.Adapter.SelectCommand = selectCommand
		//        If (Me.ClearBeforeFill = True) Then
		//            dataTable.Clear()
		//        End If
		//        Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
		//        Return returnValue
		//    End Function
		//End Class

		public partial class AppointmentsTableAdapter
		{

			public System.Data.OleDb.OleDbDataAdapter DataAdapter
			{
				get
				{
					return this.Adapter;
				}
			}
		}

		public partial class EmployeesTableAdapter
		{
			public System.Data.OleDb.OleDbDataAdapter DataAdapter
			{
				get
				{
					return this.Adapter;
				}
			}
		}

		public partial class Order_DetailsTableAdapter
		{
			public System.Data.OleDb.OleDbDataAdapter DataAdapter
			{
				get
				{
					return this.Adapter;
				}
			}
			public virtual int Fill(NorthwindData.Order_DetailsDataTable dataTable, int orderId)
			{
				this.Adapter.SelectCommand = new System.Data.OleDb.OleDbCommand(this.CommandCollection[0].CommandText + " WHERE OrderID = " + orderId);
				this.Adapter.SelectCommand.Connection = this.Connection;
				if (this.ClearBeforeFill == true)
				{
					dataTable.Clear();
				}

				int returnValue = this.Adapter.Fill(dataTable);
				return returnValue;
			}
		}

		public partial class ProductsTableAdapter
		{
			public System.Data.OleDb.OleDbDataAdapter DataAdapter
			{
				get
				{
					return this.Adapter;
				}
			}
		}


		public partial class SuppliersTableAdapter
		{
			public System.Data.OleDb.OleDbDataAdapter DataAdapter
			{
				get
				{
					return this.Adapter;
				}
			}
		}

		public partial class OrdersTableAdapter
		{
			public System.Data.OleDb.OleDbDataAdapter DataAdapter
			{
				get
				{
					return this.Adapter;
				}
			}
		}

	}


	public partial class NorthwindData
	{
	}

} //end of root namespace